home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
fielddh.exe
/
MSGBOX.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-04-30
|
18KB
|
465 lines
{*******************************************************}
{ }
{ Turbo Pascal Version 6.0 }
{ Turbo Vision Unit }
{ }
{ Copyright (c) 1990 Borland International }
{ }
{*******************************************************}
{ Doug Hood, CIS 70324,3336 }
{ Released to the PUBLIC DOMAIN }
{*******************************************************}
{ MODS: added Multiple line capability }
{ added NoEcho input box }
{ added Date input box }
{ added Button_Order_Flag }
{ (lists buttons backwards order) }
{ }
{*******************************************************}
unit MsgBox;
{$F+,O+,X+,D-}
interface
uses Objects;
const
{ Message box classes }
mfWarning = $0000; { Display a Warning box }
mfError = $0001; { Dispaly a Error box }
mfInformation = $0002; { Display an Information Box }
mfConfirmation = $0003; { Display a Confirmation Box }
{ Message box button flags }
mfYesButton = $0100; { Put a Yes button into the dialog }
mfNoButton = $0200; { Put a No button into the dialog }
mfOKButton = $0400; { Put an OK button into the dialog }
mfCancelButton = $0800; { Put a Cancel button into the dialog }
mfYesNoCancel = mfYesButton + mfNoButton + mfCancelButton;
{ Standard Yes, No, Cancel dialog }
mfOKCancel = mfOKButton + mfCancelButton;
{ Standard OK, Cancel dialog }
{-*************************************************************-}
{ MessageBox displays the given string in a standard sized }
{ dialog box. Before the dialog is displayed the Msg and Params }
{ are passed to FormatStr. The resulting string is displayed }
{ as a TStaticText view in the dialog. }
{ (use 'hello'#13'there' to split a string into 2 lines) }
{-*************************************************************-}
function MessageBox(Msg: String; Params: Pointer; AOptions: Word): Word;
function MessageBox2(Msg1: String; Params1: Pointer;
Msg2: String; Params2: Pointer;
Msg3: String; Params3: Pointer;
Msg4: String; Params4: Pointer;
AOptions: Word;
Button_Order_Normal : boolean): Word;
function Simple_Message (Msg : string) : Word;
{-*************************************************************-}
{ MessageBoxRec allows the specification of a TRect for the }
{ message box to occupy. }
{-*************************************************************-}
function MessageBoxRect (var R: TRect; Msg: String; Params: Pointer;
AOptions: Word): Word;
function MessageBoxRect2 (var R: TRect; Msg1: String; Params1: Pointer;
Msg2: String; Params2: Pointer;
Msg3: String; Params3: Pointer;
Msg4: String; Params4: Pointer;
AOptions: Word;
Button_Order_Normal : boolean): Word;
{-*************************************************************-}
{ InputBox displays a simple dialog that allows the user to }
{ type in a string. }
{-*************************************************************-}
function InputBox(Title: String; ALabel: String; var S: String;
Limit: Byte): Word;
{-*************************************************************-}
{ InputBoxRect is like InputBox but allows the specification of }
{ a rectangle. }
{-*************************************************************-}
function InputBoxRect(var Bounds: TRect; Title: String; ALabel: String;
var S: String; Limit: Byte): Word;
{-*************************************************************-}
{ NoEcho_InputBox displays a simple dialog that allows the user }
{ to type in a string, but only '*'s are echoed to the screen. }
{-*************************************************************-}
function NoEcho_InputBox (Title: String; ALabel: String; var S: String;
Limit: Byte;
Force_Uppercase : boolean): Word;
{-*************************************************************-}
{ NoEcho_InputBoxRect is like NoEcho_InputBox but allows the }
{ specification of a rectangle. }
{-*************************************************************-}
function NoEcho_InputBoxRect (var Bounds : TRect;
Title, ALabel : string;
var S : string;
Limit : byte;
Force_Uppercase : boolean) : word;
{-*************************************************************-}
{ Date_InputBox displays a simple dialog that allows the user }
{ to type in a string, checks for valid date . }
{-*************************************************************-}
function Date_InputBox (Title: String; ALabel: String; var S: String;
Limit: Byte;
Default_Today : boolean;
Var Day,Month, Year : word) : word;
{-*************************************************************-}
{ Date_InputBoxRect is like Date_InputBox but allows the }
{ specification of a rectangle. }
{-*************************************************************-}
function Date_InputBoxRect (var Bounds : TRect;
Title, ALabel : string;
var S : string;
Limit : byte;
Default_Today : boolean;
Var Day,Month, Year : word) : word;
{************************************************************************}
{************************************************************************}
{************************************************************************}
IMPLEMENTATION
uses Drivers, Views, Dialogs, App,
Fields_Color; {for noecho_inputline, date_inputline}
{*************************************************************************}
function Simple_Message (Msg : string) : Word;
begin
Simple_Message := MessageBox2 (Msg, nil, '',nil, '',nil, '',nil,
mfInformation+mfOkButton, TRUE);
end; {simple_message}
{*************************************************************************}
function MessageBox (Msg: String; Params: Pointer;
AOptions: Word): Word;
begin
MessageBox := MessageBox2 (Msg, Params, '',nil, '',nil, '',nil,
AOptions, TRUE);
end; {messagebox}
{*************************************************************************}
function MessageBox2(Msg1: String; Params1: Pointer;
Msg2: String; Params2: Pointer;
Msg3: String; Params3: Pointer;
Msg4: String; Params4: Pointer;
AOptions: Word;
Button_Order_Normal : boolean): Word;
var
R: TRect;
begin
R.Assign(0, 0, 40, 9);
R.Move((Desktop^.Size.X - R.B.X) div 2, (Desktop^.Size.Y - R.B.Y) div 2);
MessageBox2 := MessageBoxRect2 (R, Msg1, Params1,
Msg2, Params2,
Msg3, Params3,
Msg4, Params4,